//
//  SNNavigationController.m
//  SinaAuto
//
//  Created by WuWenYong on 11-3-18.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//


#import "SNNavigationController.h"
#import <QuartzCore/QuartzCore.h>

#ifndef __IPHONE_5_0
#define __IPHONE_5_0 50000
#endif


NSString* snNavigationBarBGImageName	= @"navgationbar.png";
NSString* snNavigationBarShawdowImageName	= nil;

@implementation SNNavigationController
- (id)initWithRootViewController:(UIViewController *)rootViewController
{
	if( self = [super initWithRootViewController:rootViewController] )
	{
		//	#ifdef SNUILibrary_UseNavigationController
		//self.view.backgroundColor = [UIColor clearColor];
		rootViewController.view.backgroundColor = [UIColor clearColor];
        
        if( snNavigationBarBGImageName )
		{
            UIImage* bgImage = [UIImage imageNamed:snNavigationBarBGImageName];
			//      if([self.navigationBar respondsToSelector:@selector(setBackgroundImage:forBarMetrics:)] ) {
			
            self.navigationBar.backgroundColor = [UIColor clearColor];
			if ([self.navigationBar respondsToSelector:@selector(setBackgroundImage:forBarMetrics:)])
			{
				
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_5_0
				[self.navigationBar setBackgroundImage:bgImage forBarMetrics:UIBarMetricsDefault];

#endif
			}
			else {
				self.navigationBar.layer.contents = (id)bgImage.CGImage;
			}
		}
        
	}
	return self;
}
@end




